<div class="fsh-pop">
    <input type="password" style="display: none"/>
    <div id="add_form" class="layui-form">
        <input type="hidden" name="school" id="schoolId">
        <div class="layui-form-item">
            <label class="layui-form-label"><i>*</i>班级名称</label>
            <div class="layui-input-block">
                <input type="text" name="squad_name" lay-verify="required" placeholder="请输入关键字" class="layui-input">
            </div>
        </div>
<!--        <div class="layui-form-item layui-form-text">-->
<!--            <label class="layui-form-label"><i>*</i>所在学校</label>-->
<!--            <div class="layui-input-block">-->
<!--                <input type="hidden" name="school" id="schoolId">-->
<!--                <input lay-verify="required" placeholder="请选择" class="layui-input" readonly id="schoolName">-->
<!--            </div>-->
<!--        </div>-->
        <div class="layui-form-item layui-form-text">
            <label class="layui-form-label"><i>*</i>代课老师</label>
            <div class="layui-input-block">
                <input type="hidden" name="squad_teacher_id" id="teacherId">
                <input lay-verify="required" placeholder="请输入内容" class="layui-input" id="teacherName" readonly>
            </div>
        </div>
        <div class="layui-form-item layui-form-text">
            <label class="layui-form-label"><i>*</i>入学时间</label>
            <div class="layui-input-block">
                <input lay-verify="required" placeholder="请输入内容" class="layui-input" id="startTime" readonly name="the_school_time">
            </div>
        </div>
        <div class="layui-form-item layui-form-text">
            <label class="layui-form-label"><i>*</i>毕业时间</label>
            <div class="layui-input-block">
                <input lay-verify="required" placeholder="请输入内容" class="layui-input" name="time_of_graduation" readonly id="endTime">
            </div>
        </div>
        <div class="layui-form-item layui-form-text">
            <label class="layui-form-label">是否毕业</label>
            <div class="layui-input-block">
                <input type="hidden" name="status" id="status" >
                <input type="checkbox" lay-skin="switch" lay-filter="switchTest" id="switchTest">
            </div>
        </div>
        <!--        <div class="layui-form-item layui-form-text">-->
        <!--            <label class="layui-form-label"><i>*</i>职位</label>-->
        <!--            <div class="layui-input-block">-->
        <!--                <input name="job" maxlength="20" lay-verify="required" placeholder="请输入内容" class="layui-input">-->
        <!--            </div>-->
        <!--        </div>-->
    </div>

</div>
<style type="text/css">
</style>
<script type="text/javascript">
    layui.use(['table','laydate', 'form'], function () {
        var table = layui.table;
        var layDate = layui.laydate;
        var form = layui.form;

        $('#schoolId').val(userInfo.school_id);
        //开始日期
        layDate.render({
            elem: '#startTime'
            , type: 'date'
        });
        //结束日期
        layDate.render({
            elem: '#endTime'
            , type: 'date'
        });
        //是否毕业
        form.on('switch(switchTest)', function (data) {
            $('#status').val(this.checked ? 1 : 0);
        });
        // 选择学校
        $('#schoolName').click(function () {
            showBigDialog({
                title: '选择学校'
                , template: 'school'
                , yes: function (index, layero) {
                    var checkData = table.checkStatus('schoolTable').data;
                    layer.close(index);
                    $('#schoolId').val(checkData[0].id);
                    $('#schoolName').val(checkData[0].schoolName);
                }

            })
        });
        //选择老师
        $('#teacherName').click(function () {
            showBigDialog({
                title: '选择老师'
                , template: 'teacher'
                , yes: function (index, layero) {
                    var checkData = table.checkStatus('teacherTable').data;
                    layer.close(index);
                    var ids = [];
                    var names = [];

                    for (var i = 0; i < checkData.length; i++) {
                        ids.push(checkData[i].user_id);
                        names.push(checkData[i].nickname);
                    }
                    $('#teacherId').val(ids.toString());
                    $('#teacherName').val(names.toString());
                }

            })
        });
    });


</script>
